package lines.gameengine.util;

import lines.gameengine.Ball;
import lines.gameengine.FieldPoint;
import lines.gameengine.stub.StubField;
import org.junit.Test;

import java.util.List;

import static lines.gameengine.util.LinesEngineUtils.getEmptyCells;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

/**
 * @author vpotapenko
 */
public class LinesEngineUtilsTest {

    @Test public void shouldGetEmptyCells() {
        StubField field = new StubField(3, 3);
        field.getCell(0, 0).setBall(new Ball(null));
        field.getCell(0, 1).setBall(new Ball(null));

        List<FieldPoint> points = getEmptyCells(field);
        assertThat(points.size(), equalTo(7));
        assertThat(points.contains(field.getCell(0, 0).getPoint()), equalTo(false));
        assertThat(points.contains(field.getCell(0, 1).getPoint()), equalTo(false));
        assertThat(points.contains(field.getCell(1, 1).getPoint()), equalTo(true));
    }
}
